package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Comment;
import cn.tedu._04mybatis.pojo.vo.ContentCreatedCommentVO;
import org.apache.ibatis.annotations.*;
import java.util.List;

@Mapper
public interface CommentMapper {
    /**
     * 插入评论数据
     * @param comment
     * @return
     */
    //@Insert("insert into comment(content,created,user_id,weibo_id)values (#{content},#{created},#{userId},#{weiboId})")
    abstract int insertComment(Comment comment);

    /**
     * 删除评论数据
     * @param wid
     * @return
     */
    //@Delete("delete from comment where id=#{wid}")
    abstract int deleteComment(int wid);

    /**
     * 修改评论数据
     * @param comment
     * @return
     */
    //@Update("update comment set content=#{content},created=#{created},user_id=#{userId},weibo_id=#{weiboId} where id=#{id}")
    abstract int updateComment(Comment comment);

    /**
     * 查询所有评论数据
     * @return
     */
    //@Select("select id,content,created,user_id as userId,weibo_id as weiboId from comment")
    abstract List<Comment> selectCommentAll();

    /**
     * 查询部分评论数据
     * @param cid
     * @return
     */
    //@Select("select content,created from comment where id=#{cid}")
    abstract List<ContentCreatedCommentVO> selectCommentContentCreatedCommentVO(int cid);

}
